package com.alvin.abp.domain;

import java.io.Serializable;
import java.util.Date;
/**
 * 
 * Each entity should inherit from current entity.
 * @author <a href="mailto:rex2.mj@gmail.com">Leo Meng</a>
 * @date $Date: Mar 25, 2013 $
 */
public abstract class AbstractEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	private Long id;

	private Date dateCreated;

	private Long createdBy;

	private Date dateUpdated;
	
	private Long updatedBy;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getDateCreated() {
		return dateCreated;
	}

	public Long getCreatedBy() {
		return createdBy;
	}

	public Date getDateUpdated() {
		return dateUpdated;
	}

	public Long getUpdatedBy() {
		return updatedBy;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	public void setCreatedBy(Long createdBy) {
		this.createdBy = createdBy;
	}

	public void setDateUpdated(Date dateUpdated) {
		this.dateUpdated = dateUpdated;
	}

	public void setUpdatedBy(Long updatedBy) {
		this.updatedBy = updatedBy;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AbstractEntity other = (AbstractEntity) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

}
